package sketchpad.business.dataflow.serializeobj;

import sketchpad.gui.drawinggraph.Group;
import sketchpad.gui.drawinggraph.DrawItem;

import java.io.Serializable;
import java.util.Map;

//保存的对象
public final class SerializeObj implements Serializable {

    private Map<Integer, DrawItem> drawItemMap;

    private int globalId;

    private Map<Integer, Group> groupMap;

    private SerializeObj(){}

    //建造者模式
    public static class Builder{
        private Map<Integer, DrawItem> drawItemMap;
        private int globalId;
        private Map<Integer, Group> groupMap;
        public Builder drawItem(Map<Integer, DrawItem> map){this.drawItemMap = map;return this;}
        public Builder globalId(int id){this.globalId = id;return this;}
        public Builder groupMap(Map<Integer, Group> map){this.groupMap = map; return this;}
        public SerializeObj build(){
            SerializeObj serializeObj = new SerializeObj();
            serializeObj.drawItemMap = this.drawItemMap;
            serializeObj.globalId = this.globalId;
            serializeObj.groupMap = this.groupMap;
            return serializeObj;
        }
    }

    public Map<Integer, DrawItem> getDrawItemMap() {
        return drawItemMap;
    }

    public int getGlobalId() {
        return globalId;
    }

    public Map<Integer, Group> getGroupMap() {
        return groupMap;
    }
}
